package com.mayikt;

/**
 * @Author: maplefire
 * @Description: synchronized可重入性
 * @Date: 2022/09/15 20:16
 */

public class Test01 implements Runnable{

    @Override
    public void run() {
        set();
    }

    private synchronized void set() {
        System.out.println("set方法");
        get();
    }

    private synchronized void get() {
        System.out.println("synchronized具备可重入性-get方法");
    }

    public static void main(String[] args) {
        Test01 test01 = new Test01();
        new Thread(test01).start();
        new Thread(test01).start();
    }
}
